<?php if (!defined('SERVER_ROOT')) exit('No direct script access allowed');

class nckh_Controller extends Controller {

    function __construct()
    {
        parent::__construct('giangvien', 'nckh');
        $this->check_login();
        $this->view->template->menu_html =$this->CREATE_MENU();
        $this->view->template->nhacviec_html =$this->CREATE_NHAC_VIEC(); 
        $this->CHECK_QUYEN('giangvien', 'nckh');
    }

    function main(){
        $this->dsp_all_nckh();
    }

    function dsp_all_nckh(){
        $VIEW_DATA['arr_all_nckh']= $this->model->qry_all_nckh();
        $this->view->render('dsp_all_nckh', $VIEW_DATA);
    }
    public function dsp_single_nckh($TEN_NCKH){
        $TEN_NCKH = replace_bad_char($TEN_NCKH);
        $VIEW_DATA['arr_all_loainckh'] = $this->model->SELECT_LOAINCKH_nothing();
        $VIEW_DATA['arr_single_nckh'] = $this->model->qry_single_nckh($TEN_NCKH);
        $this->view->render('dsp_single_nckh', $VIEW_DATA);
    }
    public function update_nckh()
    {
        $this->model->goback_url = $this->view->get_controller_url() . 'dsp_all_nckh';
        $this->model->update_nckh();
    }
    public function delete_nckh(){
        $this->model->goback_url = $this->view->get_controller_url() . 'dsp_all_nckh';
        $this->model->delete_nckh();
    }
}